package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ServiceAddressMapper;
import com.ruoyi.system.domain.ServiceAddress;
import com.ruoyi.system.service.IServiceAddressService;

/**
 * 服务地址
Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-16
 */
@Service
public class ServiceAddressServiceImpl implements IServiceAddressService 
{
    @Autowired
    private ServiceAddressMapper serviceAddressMapper;

    /**
     * 查询服务地址

     * 
     * @param saId 服务地址
ID
     * @return 服务地址

     */
    @Override
    public ServiceAddress selectServiceAddressById(Long saId)
    {
        return serviceAddressMapper.selectServiceAddressById(saId);
    }

    /**
     * 查询服务地址
列表
     * 
     * @param serviceAddress 服务地址

     * @return 服务地址

     */
    @Override
    public List<ServiceAddress> selectServiceAddressList(ServiceAddress serviceAddress)
    {
        return serviceAddressMapper.selectServiceAddressList(serviceAddress);
    }

    /**
     * 新增服务地址

     * 
     * @param serviceAddress 服务地址

     * @return 结果
     */
    @Override
    public int insertServiceAddress(ServiceAddress serviceAddress)
    {
        List<ServiceAddress> serviceAddresses = serviceAddressMapper.selectServiceAddressList(serviceAddress);
        serviceAddress.setSaState(serviceAddresses.size()+1L);
        return serviceAddressMapper.insertServiceAddress(serviceAddress);
    }

    /**
     * 修改服务地址

     * 
     * @param serviceAddress 服务地址

     * @return 结果
     */
    @Override
    public int updateServiceAddress(ServiceAddress serviceAddress)
    {
        return serviceAddressMapper.updateServiceAddress(serviceAddress);
    }

    /**
     * 批量删除服务地址

     * 
     * @param saIds 需要删除的服务地址
ID
     * @return 结果
     */
    @Override
    public int deleteServiceAddressByIds(Long[] saIds)
    {
        return serviceAddressMapper.deleteServiceAddressByIds(saIds);
    }

    /**
     * 删除服务地址
信息
     * 
     * @param saId 服务地址
ID
     * @return 结果
     */
    @Override
    public int deleteServiceAddressById(Long saId)
    {
        return serviceAddressMapper.deleteServiceAddressById(saId);
    }
}
